import re

fr = open("专利A类（1万）.txt","r",encoding = "utf-8")
fw = open("专利文本1.txt","w",encoding = "utf-8")
p = re.compile("\"abs\":\"(.*?)\"")

c = 0
f1 = fr.readlines()
for line in f1:
    line = line.strip()
    if line == "\"abs\":\"\"}," or line == "\"abs\":\"无\"},":
        continue
    elif "The" in line:
        continue
    elif "abs" in line:
        l = p.findall(line)
        fw.write(l[0]+'\n')
        c += 1
print(c)
fr.close()
fw.close()
print("ok")
